cmake_minimum_required(VERSION 3.12)
get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
message(STATUS "current directory name: ${PROJECT_NAME}")
project(${PROJECT_NAME} VERSION 1.0.0)
# 设置自动生成moc文件,AUTOMOC打开可以省去QT5_WRAP_CPP命令
SET(CMAKE_AUTOMOC ON)
# 设置自动生成ui.h文件,AUTOUIC打开可以省去QT5_WRAP_UI命令
SET(CMAKE_AUTOUIC ON)
# 【optional】设置自动处理.qrc文件
SET(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_PREFIX_PATH "D:\\Qt\\Qt5.12.12\\5.12.12\\msvc2017")
aux_source_directory(. src_all)

set(src_file ../aqp/aqp.qrc)
if(EXISTS ${PROJECT_NAME}.qrc)
set(rc_file_cur ${PROJECT_NAME}.qrc)
list(APPEND src_all ${rc_file_cur} ${src_file})
endif()

aux_source_directory(../aqp src_aqp)
aux_source_directory(../option_parser src_opt)


list(REMOVE_ITEM src_aqp "../aqp/main.cpp")
list(REMOVE_ITEM src_opt "../option_parser/main.cpp")

list(APPEND src_all ${src_aqp})
list(APPEND src_all ${src_opt})

find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets Svg PrintSupport Concurrent Script Network Xml)

message(STATUS "all src:" ${src_all})

include_directories(../aqp ../option_parser)

add_executable(${PROJECT_NAME} ${src_all})
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Svg Qt5::PrintSupport Qt5::Concurrent Qt5::Script Qt5::Network Qt5::Xml)